package com.yaorange.guild.association.controller;

import com.yaorange.guild.association.entity.BsAssociation;
import com.yaorange.guild.association.service.BsAssociationService;
import com.yaorange.response.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 协会信息Controller
 */
@RestController
@RequestMapping("/associations")
public class BsAssociationController {

    @Autowired
    private BsAssociationService bsAssociationService;

    /**
     * 获取单条记录
     * @return
     */
    @GetMapping("/getOne")
    public Result getOne(){
        BsAssociation association= bsAssociationService.getOne();
        return Result.success(association);
    }

    /**
     * 根据主键更新协会信息
     */
    @PutMapping("/{id}")
    public Result updateById(@PathVariable Long id, @RequestBody BsAssociation association) {
        association.setId(id);
        bsAssociationService.updateById(association);
        return Result.success("更新成功");
    }
}
